<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <body>
        <ui:composition template="./../../WEB-INF/templates/newMainCompanyTemplate.xhtml">
            <ui:define name="companyContent">
                <h:outputStylesheet library="css" name="company/company.css"></h:outputStylesheet>
                <h:outputStylesheet library="css" name="company/preferences.css"></h:outputStylesheet>
                <h:outputStylesheet library="css" name="company/preferences_desktop.css" media="screen and (min-width:1025px) and (max-width:1600px)"></h:outputStylesheet>
                <h:outputStylesheet library="css" name="company/preferences_desktop_wide.css" media="screen and (min-width : 1601px)"></h:outputStylesheet>
                <h:outputStylesheet library="css" name="company/preferences_tablet.css" media="screen and (min-device-width : 768px) and (max-device-width : 1024px), screen and (max-width:1024px)"></h:outputStylesheet>
                <h:outputStylesheet library="css" name="company/preferences_smartphone.css" media="screen and (min-device-width : 320px) and (max-device-width : 767px), screen and (max-width:767px)"></h:outputStylesheet>
                
                <h:form id="preferencesForm"  styleClass="verticalAlignTop inlineBlock preferencesForm" >
                    <p:growl id="preferencesGrowl" showDetail="false" life="4000"/>
                         <p:panel header="#{messages.Preferences}" styleClass="darkGrayBackgroundTitle darkGrayBorder panelCompanyPreferences noPaddingTitle" id="preferencesPanel">
                             <p:panel>
                                <div class="inlineBlock verticalAlignTop textAlignRight internalLeftDivWidth">
                                   <h:outputLabel for="selectLanguage" styleClass="marginRightLabels" value="#{messages.Language}" />
                               </div>
                               <div class="inlineBlock verticalAlignTop internalRightDivWidth">
                                   <p:selectOneMenu filter="true" filterMatchMode="contains" required="true" converter="#{languageConverter}"  id="selectLanguage"  value="#{preferencesCompanyBean.languageCollector}" effect="fade"  label="#{messages.Language}" styleClass="companyElementInput" requiredMessage="#{messages.LanguageRequired}">  
                                       <f:selectItems value="#{userResourcesBean.languages}" var="language" itemLabel="#{languageBundle[language.idLanguage.toString()]}" itemValue="#{language}"/>  
                                   </p:selectOneMenu>
                               </div> 

                               <div class="inlineBlock verticalAlignTop textAlignRight internalLeftDivWidth">
                                   <h:outputLabel for="facesPerRow" styleClass="marginRightLabels" value="#{messages.FacesPerRow}" />
                               </div>
                               <div class="inlineBlock verticalAlignTop internalRightDivWidth">
                                   <p:selectOneMenu filter="true" filterMatchMode="contains" required="true" id="facesPerRow" value="#{preferencesCompanyBean.company.companyConfiguration.facesPerRow}" effect="fade" styleClass="companyElementInput"  label="#{messages.facesPerRow}">  
                                        <f:selectItem itemLabel="3" itemValue="#{3}"/>
                                        <f:selectItem itemLabel="4" itemValue="#{4}"/>
                                        <f:selectItem itemLabel="5" itemValue="#{5}"/>
                                        <f:selectItem itemLabel="6" itemValue="#{6}"/> 
                                   </p:selectOneMenu>
                               </div> 

                               <div class="inlineBlock verticalAlignTop textAlignRight internalLeftDivWidth">
                                   <h:outputLabel for="showAdquiredProfiles" styleClass="marginRightLabels" value="#{messages.ShowAdquiredProfiles}" />
                               </div>
                               <div class="inlineBlock verticalAlignTop internalRightDivWidth">
                                   <p:selectOneMenu filter="true" filterMatchMode="contains" required="true" id="showAdquiredProfiles" value="#{preferencesCompanyBean.company.companyConfiguration.showAdquiredProfiles}" effect="fade" styleClass="companyElementInput" label="#{messages.ShowAdquiredProfiles}">  
                                        <f:selectItem itemLabel="#{messages.Yes}" itemValue="#{true}"/>
                                        <f:selectItem itemLabel="#{messages.No}" itemValue="#{false}"/>  
                                   </p:selectOneMenu>
                               </div> 

                                <div class="inlineBlock verticalAlignTop textAlignRight internalLeftDivWidth">
                                    <h:outputLabel for="showName" styleClass="marginRightLabels" value="#{messages.ShowName}" />
                               </div>
                               <div class="inlineBlock verticalAlignTop internalRightDivWidth">
                                   <p:selectOneMenu filter="true" filterMatchMode="contains" required="true" id="showName" value="#{preferencesCompanyBean.company.companyConfiguration.showName}" effect="fade" styleClass="companyElementInput" label="#{messages.ShowName}">  
                                        <f:selectItem itemLabel="#{messages.Yes}" itemValue="#{true}"/>
                                        <f:selectItem itemLabel="#{messages.No}" itemValue="#{false}"/>  
                                   </p:selectOneMenu>
                               </div> 

                               <div  class="inlineBlock verticalAlignTop textAlignRight editButtonDiv">
                                   <p:commandButton update=":preferencesForm:preferencesGrowl" styleClass="blueBackgroundStrong" value="#{messages.Edit}" actionListener="#{preferencesCompanyBean.save()}" process="@parent" /> 
                               </div>
                             </p:panel>
                         </p:panel>
                         
                </h:form>
                <h:form id="preferencesPasswordForm"  styleClass=" verticalAlignTop inlineBlock preferencesPasswordForm" >
                    <p:panel header="#{messages.ChangePassword}" styleClass="lightGrayBackgroundTitle lightGrayBorder panelCompanyPreferences noPaddingTitle" id="preferencesPasswordPanel">  
                        <p:panel>
                            <div class="inlineBlock verticalAlignTop textAlignRight internalLeftDivWidth">
                                <h:outputLabel for="passwordOld" styleClass="marginRightLabels" value="#{messages.OldPassword}" />
                            </div>
                            <div class="inlineBlock verticalAlignTop internalRightDivWidth">
                                <p:password styleClass="companyElementInput" id="passwordOld" required="true" requiredMessage="#{messages.PasswordRequired}" label="#{messages.Password}">
                                    <f:attribute name="idUser" value="#{preferencesCompanyBean.company.idUser.idUser}" />
                                    <f:validator  binding="#{passwordValidator}"></f:validator>
                                 </p:password>
                            </div>
                            <div class="inlineBlock verticalAlignTop textAlignRight internalLeftDivWidth">
                                <h:outputLabel for="password" styleClass="marginRightLabels" value="#{messages.NewPassword}" />

                            </div>
                            <div class="inlineBlock verticalAlignTop internalRightDivWidth">
                                <p:password styleClass="companyElementInput" id="password" match="password2" feedback="true" value="#{preferencesCompanyBean.company.idUser.password}" required="true" requiredMessage="#{messages.PasswordRequired}" label="#{messages.Password}" validatorMessage="#{messages.PasswordNoMatch}">
                                    <f:validateLength minimum="5" maximum="30"></f:validateLength>
                                </p:password>
                            </div>
                            <div class="inlineBlock verticalAlignTop textAlignRight internalLeftDivWidth">
                                <h:outputLabel for="password2" styleClass="marginRightLabels" value="#{messages.RepeatNewPassword}" />

                            </div>
                            <div class="inlineBlock verticalAlignTop internalRightDivWidth">
                                <p:password id="password2" styleClass="companyElementInput" feedback="true" value="#{preferencesCompanyBean.company.idUser.password}" required="true" requiredMessage="#{messages.RepeatPasswordRequired}" label="#{messages.RepeatPassword}">
                                </p:password>
                            </div>
                            <div  class="inlineBlock editButtonDiv verticalAlignTop textAlignRight">
                                <p:commandButton process="preferencesPasswordPanel" update=":preferencesForm:preferencesGrowl :preferencesPasswordForm:preferencesPasswordPanel" styleClass="blueBackgroundStrong" value="#{messages.Edit}" actionListener="#{preferencesCompanyBean.changePassword()}" /> 
                            </div>
                        </p:panel>
                    </p:panel>
                </h:form>    
            </ui:define>
        </ui:composition>
    </body>
</html>
